package com.by.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.06.07.17.28
 */
@Configuration
public class RetConfig {
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){
//        HttpComponentsClientHttpRequestFactory factory=new HttpComponentsClientHttpRequestFactory();
//        factory.setConnectTimeout(1);
//        factory.setReadTimeout(1); //设置超时处理
        return new RestTemplate();
    }
}
